home *** CD-ROM | disk | FTP | other *** search
/ Informática Multimedia 1995 April / Informatica Multimedia CD - Epimundo.iso / DOS / FILEFIND / FED16.ZIP / FED.DOC < prev    next >
Encoding:
Text File  |  1993-09-18  |  13.7 KB  |  297 lines

  1. TITLE:         FED.EXE     Version: 1.6
  2.  
  3. PURPOSE:       Non-interactive text file editor
  4.  
  5. DATE:          September 1993
  6.  
  7. AUTHOR:        Geoffrey H. Gillmer
  8.                18 Holmdene Road
  9.                7800 Plumstead
  10.                SOUTH AFRICA
  11.  
  12. DESCRIPTION:   FED is a non-interactive text file editor.  Files are 
  13.                processed one line at a time so that there is no restriction
  14.                on the size of files which can be processed.  Individual
  15.                lines can be up to 32K in size.  Edit commands (up to 100) 
  16.                are stored in a command file.  The multiple edit operations 
  17.                are performed in a single pass.
  18.  
  19. OPERATION:     The command line invocation is:
  20.  
  21.                fed targetfile commandfile ─┘
  22.  
  23.                1.   "targetfile" is the text file to be converted and is any 
  24.                     DOS path/file name.  Multiple files may be specified by
  25.                     using the normal DOS wildcards (* and ?).  However, the 
  26.                     following restrictions are placed on specified target 
  27.                     file names to prevent the accidental processing of non- 
  28.                     text files:
  29.  
  30.                     a) Only files with BAT, DOC or TXT extensions as well
  31.                        as CONFIG.SYS will be processed when using wildcards
  32.                        (* or ???) in the file name extension.  
  33.                        
  34.                     b) For all other cases, files with BAK, COM or EXE 
  35.                        extensions as well as the currently active 
  36.                        commandfile will be automatically excluded.  
  37.  
  38.                     Original targetfiles are saved with a BAK extension 
  39.                     provided modifications have been made.  Note that
  40.                     this program will process read-only files.
  41.  
  42.                2.   "commandfile" is the unambiguous DOS path/file name 
  43.                     which contains the string edit commands.  Edit commands 
  44.                     are described below.  Although no restrictions are 
  45.                     placed upon the commandfile name, for sake of clarity it 
  46.                     is suggested that you adopt a consistent naming scheme 
  47.                     for them, say, with a *.FED extension.  If you use the
  48.                     FED extension for commandfiles, then the extension may
  49.                     be omitted.
  50.  
  51.                EXAMPLES . . .
  52.  
  53.                C> fed testfile.txt testfile.fed ─┘
  54.            
  55.                The above command line will process the input file 
  56.                "testfile.txt" using the command file "testfile.fed". 
  57.                The original "testfile.txt" will be retained as
  58.                "testfile.bak" provided modifications were made.
  59.  
  60.                C> fed c:\util\*.bat bat.fed ─┘
  61.  
  62.                The above command line will process all files with a BAT
  63.                extension in the "c:\util" subdirectory using the commandfile
  64.                "bat.fed".  Copies of the original files before conversion 
  65.                will be retained with BAK extensions.
  66.  
  67. EDIT           FED command files are ASCII text files which contain the 
  68. COMMANDS:      edit instructions used by the program.  Up to 100 of these
  69.                commands can be entered in a single file, one command per 
  70.                line.  There is no practical limit to the length of a single 
  71.                command line (in theory these lines can be up to 32K in 
  72.                size).  Blank lines will be ignored. 
  73.  
  74.                string1//string2   will replace all occurrences of string1 
  75.                                   with string2.
  76.  
  77.                string1||string2   will replace lines containing string1 with 
  78.                                   the line string2.
  79.  
  80.                string1&&string2   will append string2 to lines containing 
  81.                                   string1.  Trailing blanks in the lines 
  82.                                   with string1 will be removed before any
  83.                                   modifications are made.
  84.  
  85.                string1^^string2   will prefix string2 to lines containing 
  86.                                   string1.  The insertion will be made 
  87.                                   after any leading blanks to maintain the
  88.                                   same line indentation.
  89.  
  90.                string1--[string2] will delete lines containing string1 and 
  91.                                   will optionally continue deleting lines up 
  92.                                   to and including the next line containing 
  93.                                   string2.  Be careful of this one; if you
  94.                                   specify string2 and a match is found for
  95.                                   string1 but not for string2, then all lines
  96.                                   from string1 will be deleted.
  97.  
  98.                string1~~          will delete all lines NOT containing 
  99.                                   string1.
  100.  
  101.                string1!!string2   will strip all occurrences of string2 
  102.                                   from lines containing string1.
  103.  
  104.                [string1]<<string2 will insert the line string2 ABOVE lines 
  105.                                   matched by string1.  There is no 
  106.                                   restriction on the number of new lines 
  107.                                   which can be inserted above the same line 
  108.                                   matched by string1 (other than the 100 
  109.                                   command limitation).  The line indentation 
  110.                                   (leading blanks) for string2 will be the 
  111.                                   same as that for the line containing 
  112.                                   string1.  If string1 is omitted, then the 
  113.                                   line string2 will be placed at the 
  114.                                   beginning of the targetfile.
  115.  
  116.                [string1]>>string2 will insert the line string2 BELOW lines 
  117.                                   containing string1.  There is a limitation
  118.                                   of 50 line inserts below the same line 
  119.                                   matched by string1.  The line indentation
  120.                                   (leading blanks) for string2 will be the 
  121.                                   same as that for the line containing 
  122.                                   string1.  If string1 is omitted, then the 
  123.                                   line string2 will be appended to the 
  124.                                   targetfile.
  125.            
  126.                NOTES . . . 
  127.  
  128.                The string patterns for matching are not case sensitive.
  129.  
  130.                Blank spaces before string1 or after string2 in the 
  131.                commandfile are not significant.  However, you can use an 
  132.                underscore to prefix a first blank space to string1 or to 
  133.                append a last blank space to string2.  Any further blanks 
  134.                between the underscore and string1/string2 will then also 
  135.                become part of the strings.
  136.  
  137.                You can prefix a caret (^) to string1 (and/or string2 for the 
  138.                delete lines option only) to force the program to look for a 
  139.                match only at the beginning of the target lines(s).  Note
  140.                that leading blanks in the target lines are ignored when 
  141.                testing for matches.  Do not therefore include blank spaces
  142.                between the caret and the start of the search strings since
  143.                these will also be ignored.
  144.  
  145.                Comments can be entered in a command file as lines by 
  146.                themselves, or set off from a command:
  147.  
  148.                '   This is a comment line by itself.  Everything 
  149.                '   following a single quote will be treated as a 
  150.                '   comment.
  151.  
  152.                EXAMPLES . . .
  153.  
  154.                temp//tmp          ' global change "temp" to "tmp"
  155.  
  156.                ^REM//             ' remove "REM" from the beginning of 
  157.                                   ' lines only (leading blanks ignored)
  158.  
  159.                files=||files=40   ' replace lines containing "files=" 
  160.                                   ' with line "files=40"
  161.  
  162.                ^files=||files=40  ' replace lines beginning with "files=" 
  163.                                   ' with line "files=40"
  164.  
  165.                path&&c:\util;     ' append "c:\util;" to lines
  166.                                   ' containing "path"
  167.  
  168.                smartdrv^^REM_     ' prefix "REM " to lines containing
  169.                                   ' "smartdrv" 
  170.  
  171.                del *--            ' delete lines containing "del *"
  172.  
  173.                del *--^xyz _      ' delete lines containing "del *" 
  174.                                   ' and continue deleting up to and 
  175.                                   ' including the next line starting 
  176.                                   ' with "xyz  " (leading blanks ignored)
  177.  
  178.                ^rem~~             ' delete all lines not beginning with
  179.                                   ' "rem".
  180.  
  181.                cache!!/write=off  ' strip "/write=off" from lines 
  182.                                   ' containing "cache"
  183.  
  184.                echo off>>cls      ' insert line "cls" below lines 
  185.                                   ' containing "echo off"
  186.  
  187.                cls<<echo off      ' insert line "echo off" above lines 
  188.                                   ' containing "cls"
  189.  
  190.                   <<@echo off     ' insert line "@echo off" at the 
  191.                                   ' beginning of the targetfile
  192.  
  193.                   >>menu          ' append line "menu" to the targetfile
  194.  
  195.  
  196.                SPECIAL NOTE . . .
  197.  
  198.                The order of the edit commands in the commandfile may
  199.                influence the results obtained.  For example, consider 
  200.                the two following commands:
  201.  
  202.                smartdrv^^REM_     ' prefix "REM " to lines containing
  203.                                   ' "smartdrv"
  204.  
  205.                REM !!REM_         ' strip "REM " from lines containing
  206.                                   ' "REM "
  207.  
  208.                These will have no net effect on the line containing 
  209.                "smartdrv" since the first command will add "REM " while
  210.                the following command will cancel this modification.
  211.                However, if you swop the order of these commands in the
  212.                commandfile, the line containing "smartdrv" will retain
  213.                the "REM " addition.
  214.  
  215.                Note that it is not possible to modify or refer to newly 
  216.                inserted lines (using "||", ">>" or "<<" commands) via other 
  217.                edit commands in the same commandfile.
  218.  
  219. DISCLAIMER:    This program is distributed as shareware.  Use it, copy 
  220.                it, upload it, give it to your friends.  Please distribute 
  221.                only the complete program in ZIP form, including the 
  222.                document and example files.  No warranties, either expressed 
  223.                or implied, are given by the author or distributor of the 
  224.                program, and the user accepts all risk of damage arising out 
  225.                of the application and use of the program. 
  226.  
  227.                -----------------------------------------------------------
  228.                Send comments/bug reports/contributions to:
  229.  
  230.                            ╔═══════════════════════╗
  231.                            ║    G.H. Gillmer       ║
  232.                            ║    18 Holmdene Road   ║
  233.                            ║    7800 Plumstead     ║
  234.                            ║    SOUTH AFRICA       ║
  235.                            ╚═══════════════════════╝
  236. ===========================================================================
  237.  
  238. VERSION HISTORY
  239. ---------------
  240.  
  241. 1.32 (June 1993)    First public release.
  242.  
  243.  
  244. 1.33 (June 1993)    Append command (&&) changed to insert in front of 
  245.                     trailing blanks.
  246.  
  247.                     Prefix command (^^) changed to insert after leading 
  248.                     blanks.
  249.  
  250.                     Search strings anchored to the beginning of target 
  251.                     lines now ignore leading blanks in the target lines 
  252.                     when looking for matches.
  253.  
  254.                     Documentation expanded.
  255.  
  256.  
  257. 1.34 (June 1993)    The program now attempts to maintain the correct 
  258.                     indentation when inserting new lines.
  259.  
  260.  
  261. 1.4  (July 1993)    The names of files which can be processed made less
  262.                     restrictive.
  263.  
  264.                     If the commandfile has a FED extension, then the 
  265.                     extension may now be omitted when specifying the
  266.                     commandfile on the command line.
  267.  
  268.                     A new command (~~) added which will delete lines NOT
  269.                     matching the specified search string.
  270.  
  271.                     The maximum number of commands which can be stored in
  272.                     a commandfile increased from 50 to 100.
  273.  
  274.                     The maximum number of inserts below the same line
  275.                     increased from 20 to 50.
  276.  
  277.                     The program made more compact by omitting debugging 
  278.                     code.
  279.  
  280.  
  281. 1.41 (July 1993)    Reinstated debug code to re-enable ability to abort 
  282.                     program execution by pressing Ctrl+Break.
  283.  
  284.  
  285. 1.6  (Sept 1993)    The program will now process read-only files without 
  286.                     errors.
  287.  
  288.                     Indentation bug fixed.
  289.  
  290.                     Bug relating to directory name extensions fixed.
  291.  
  292.                     Ability to prefix and append lines to the targetfile
  293.                     added.
  294.  
  295.                     Leading blanks in target lines now included in pattern 
  296.                     searches.
  297.